package com.reservationserver.mapper.user;

import com.reservationpojo.domin.vo.Adduservo;
import com.reservationpojo.domin.vo.Getuservo;
import com.reservationpojo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface Usermapper {

    @Update("UPDATE user SET black=true WHERE student_id=#{id}")
    void update(String id);
    @Update("UPDATE user SET black=false WHERE student_id=#{id}")
    void unupdate(String id);

    void deleteuser(List<String> userIds);
    @Insert("INSERT INTO user (student_id,number,user_name,start_date,graduation_date,gender,wx_id)" +
        "VALUES (#{studentId},#{number},#{name},#{startDate},#{graduationDate},#{gender},#{wxId});")
    void adduser(Adduservo uservo);
    @Select("Select student_id, number, black, start_date, graduation_date, gender, user_name, wx_id, guard " +
            "from user where wx_id=#{wxId}")
    User userlog(String wxId);

    List<User> getusermapper(Getuservo getuservo,int page);

    @Update("UPDATE user SET guard=true WHERE student_id=#{id}")
    User upguard(String id);
    @Update("UPDATE user SET guard=false WHERE student_id=#{id}")
    User upunguard(String id);
    @Delete("DELETE FROM user\n" +
            "WHERE graduation_date < NOW();")
    void deleteTime();
    @Select("select student_id, number, black, start_date, graduation_date, gender, user_name, initial, wx_id, guard from user where student_id=#{id}")
    User getusercl(String id);
}
